import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/frame/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/frame/profile',
    method: 'post',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/frame/logout',
    method: 'post'
  })
}
// 用户列表
export function userList(params) {
  return request({
    url: '/users',
    params
  })
}
// 用户添加
export function addUser(data) {
  return request({
    url: '/users',
    method: 'POST',
    data
  })
}
// 删除用户
export function delUser(id) {
  return request({
    url: `/users/${id}`,
    method: 'delete'
  })
}
// 修改用户
export function editUser(data) {
  return request({
    url: '/users/' + data.id,
    method: 'PUT',
    data
  })
}
export function usersList(id) {
  return request({
    url: `/users/${id}`
  })
}
